<!--
 * @Author: 曹捷
 * @Date: 2020-11-08 14:49:31
 * @LastEditors: 曹捷
 * @LastEditTime: 2020-12-28 20:19:47
 * @Description: fileContent
-->
<template>
  <div class="obit-list-item " :class="{'form-item':type ==='form'}" @click="clickItem">
    <div class="obit-list-item__container" :class="{'p-r-0':showRight}">
      <i v-if="iconClass" v-show="!isRightImg" :class="iconClass" class="iconfont icon-cls"></i>
      <img :style="imgStyle" class="img-show" v-show="isRightImg" :src="iconClass" />
      <div class="obit-list-item__header">
        <div class="title">{{title}}</div>
        <div class="subTitle color-tips" style="font-size:24rpx" v-if="subTitle">{{subTitle}}</div>
      </div>
      <div class="obit-list-item__content">
        <slot></slot>
      </div>
      <div class="obit-list-item__extra" @click="rightEvent">
        <slot name="right"></slot>
        <span v-if="rightText"> {{rightText}}</span>
      </div>
    </div>
    <u-icon v-if="showRight" :size="28" class="obit-icon-wrapper" color="#bbb" name="arrow-right"></u-icon>

  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String
    },
    rightText: {
      type: [String, Number],
      default: ''
    },
    showRight: {
      type: Boolean,
      default: false
    },
    isRightImg: {
      type: Boolean,
      default: false
    },
    // item form
    type: {
      type: String,
      default: 'item'
    },
    subTitle: {
      type: String,
      default: ''
    },
    iconClass: {
      type: String,
      default: ''
    },
    imgStyle: {
      type: Object,
      default: () => {}
    }
  },
  methods: {
    rightEvent () {
      this.$emit('right')
    },
    clickItem () {
      this.$emit('clickEvent')
    },
  }
}
</script>

<style lang="scss">
.obit-list-item_top {
  border-top: 2rpx solid #e4e7ed;
}
.form-item {
  .obit-list-item__header {
    width: 200rpx;
  }
  .uni-input-wrapper {
    padding: 0;
  }
}
.obit-list-item__container {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 24rpx 30rpx;
  padding-left: 30rpx;
  flex: 1;
  overflow: hidden;
  > .icon-cls{
    font-size: 42rpx;
    margin-right: 10rpx;
    color: rgba(104, 104, 104, 1);
  }
  .img-show{
    width:60rpx;
    height:60rpx;
  }
  .obit-list-item__header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    .title{
      font-size: 32rpx;
    }
  }
  .obit-list-item__content {
    display: flex;
    padding-right: 16rpx;
    flex: 1;
    color: #3b4144;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
  }
  .obit-list-item__extra {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    color: #686868;
    font-size: 28rpx;
  }
}
.obit-icon-wrapper {
  display: flex;
  align-items: center;
  padding: 0 10rpx;
}
</style>